using Godot;
using System;

public partial class LevelFailScreen : Node2D
{
    UIButton uIButton;
    CanvasLayer layer;

    public override void _Ready()
    {
        base._Ready();
        layer = GetNode<CanvasLayer>("CanvasLayer");
        uIButton = GetNode<UIButton>("CanvasLayer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/UIButton");
        uIButton.OnPressed += OnPressedHandler;
    }

    private void OnPressedHandler(UIButton button)
    {
        SceneManager.Instance.LoadScene(Path.SCENE_START);
        layer.Hide();
    }

    public void ShowFail()
    {
        layer.Show();
    }
}
